import { Component, OnInit, OnDestroy } from '@angular/core';
import { NbThemeService } from '@nebular/theme';
import { BasicService } from '../../../@core/data/basic.service';
const api = 'courses';
@Component({
  selector: 'ngx-kitten',
  styleUrls: ['./kitten.component.scss'],
  templateUrl: './kitten.component.html',
})
export class KittenComponent implements OnInit, OnDestroy {

  currentTheme: string;
  themeSubscription: any;

  courses: any[];

  constructor(private themeService: NbThemeService, private basicService: BasicService) {
    this.themeSubscription = this.themeService.getJsTheme().subscribe(theme => {
      this.currentTheme = theme.name;
    });
  }
  ngOnInit() {
    this.basicService.getAll(api)
      .subscribe((courses: any) => {
        this.courses = courses.rows;
      });
  }
  ngOnDestroy() {
    this.themeSubscription.unsubscribe();
  }
}
